package com.lnj.api;

import com.lnj.utils.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(   name="idGenerator")
public interface IdGeneratorApi {

    /**
     * summary = "生成一个Id号", description = "生成一个Id号，格式:[ 1bit | 41bit时间戳 | 10bit机器ID（5 datacenter + 5 worker）| 12bit序列号 ]"
     * @return
     */
    @GetMapping("/id/next")
    public ResponseResult getNextId();

    /**
     * summary = "生成size个Id号", description = "Id号格式:[ 1bit | 41bit时间戳 | 10bit机器ID（5 datacenter + 5 worker）| 12bit序列号 ]"
     * @param size
     * @return
     */
    @GetMapping("/id/batch")
    public ResponseResult getBatchIds(@RequestParam(value="size", defaultValue = "10") int size) ;

    /**
     * 解析时间戳
     */
    @GetMapping("/id/parse/time")
    public ResponseResult parseTime(@RequestParam("id") long id);

    /**
     * 解析 datacenterId
     */
    @GetMapping("/id/parse/datacenter")
    public ResponseResult parseDatacenter(@RequestParam("id") long id) ;


    /**
     * 解析 workerId
     */
    @GetMapping("/id/parse/worker")
    public ResponseResult parseWorker(@RequestParam("id") long id) ;


}
